package com.addzero.web.ui.hooks.tree

import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

// 渲染节点内容
@Composable
fun <T> defaultTreeNodeRender(
    node: T,
    getType: (T) -> NodeTypes,
    getLabel: (T) -> String,
) {
    val label = getLabel(node)
    val type = getType(node)
    when (type) {
        NodeTypes.FOLDER -> {
            Text(
                text = "📁 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.FILE -> {
            Text(
                text = "📄 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.DOCUMENT -> {
            Text(
                text = "📝 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.IMAGE -> {
            Text(
                text = "🖼️ ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.VIDEO -> {
            Text(
                text = "🎬 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.AUDIO -> {
            Text(
                text = "🎵 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.LINK -> {
            Text(
                text = "🔗 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.TAG -> {
            Text(
                text = "🏷️ ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.TASK -> {
            Text(
                text = "✅ ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        NodeTypes.NOTE -> {
            Text(
                text = "📔 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }
        
        NodeTypes.MENU -> {
            Text(
                text = "📋 ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }
        
        NodeTypes.PAGE -> {
            Text(
                text = "🖥️ ${label}", modifier = Modifier.padding(start = 8.dp)
            )
        }

        else -> {
            Text(
                text = label, modifier = Modifier.padding(start = 8.dp)
            )
        }
    }
}
